package hos.demo

import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import hos.demo.activity.MediaActivity
import hos.demo.ui.theme.IntentTheme
import hos.permission.PermissionX

class MainActivity : AppCompatActivity() {

    private val permissionX = PermissionX.init(this)

    private var path by mutableStateOf("")

    @OptIn(ExperimentalMaterial3Api::class)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            IntentTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {
                    LazyColumn(content = {
                        item {
                            ListItem(headlineText = {
                                Text(text = "媒体拍摄")
                            }, modifier = Modifier.clickable {
                                startActivity(Intent(this@MainActivity, MediaActivity::class.java))
                            })
                            ListItem(headlineText = {
                                Text(text = "选择文件")
                            }, modifier = Modifier.clickable {

                            })
                            ListItem(headlineText = {
                                Text(text = "电话短信")
                            }, modifier = Modifier.clickable {

                            })
                            ListItem(headlineText = {
                                Text(text = "分享")
                            }, modifier = Modifier.clickable {

                            })
                            ListItem(headlineText = {
                                Text(text = "应用相关")
                            }, modifier = Modifier.clickable {

                            })
                            ListItem(headlineText = {
                                Text(text = "系统设置")
                            }, modifier = Modifier.clickable {

                            })
                        }
                    })
                }
            }
        }
    }
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
    Text(
        text = "Hello $name!",
        modifier = modifier
    )
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    IntentTheme {
        Greeting("Android")
    }
}